package com.appsys.service;

import com.appsys.dao.VersionMapper;
import com.appsys.pojo.PublishStatus;
import com.appsys.pojo.Version;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName PublishStatusService
 * @Description TODO
 * @Author YinLiangTao Email:1517535831@qq.com
 * @Date 2022/3/3 11:09
 * @Version 1.0
 */
@Service
public class VersionService {
    @Resource
    private VersionMapper versionMapper;
    //根据id获取版本信息
    public Version getVersionById(Integer id){
        return versionMapper.getVersionById(id);
    }
    //根据appId获取版本信息
    public List<Version> getVersionByAppId(Integer appId){
        return versionMapper.getVersionByAppId(appId);
    }
    //增加新版本
    public boolean addVersion(Version version){
        if(versionMapper.addVersion(version) > 0){
            return true;
        }
        return false;
    }
    //更新新版本
    public boolean updateVersion(Version version){
        if(versionMapper.updateVersion(version) >= 0){
            return true;
        }
        return false;
    }
    //删除版本信息
    public int deleteVersionByAppId(int id){
        return versionMapper.deleteVersionByAppId(id);
    }
}
